home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / msh20.zip / MSHFILES.ZIP / MSH.ART < prev    next >
Text File  |  1992-03-26  |  17KB  |  287 lines

  1. It's Not Just Another DOS Shell
  2.  
  3. Michael Durant, NEI-PC
  4.  
  5. Since I have been looking for "The Perfect DOS Shell", I investigate every new 
  6. shell program I can find.  They all seemed to have one (or more) severe short 
  7. commings to me.  Now I have found the answer, Mi-Shell.  This really is the 
  8. one shell for everyone!  "How can that be", you may well ask?  Well, the 
  9. reason is that Mi-Shell (MSH) is completely configurable (programmable) by the 
  10. user.  You can get anything you want from Mi-Shell (sung to the tune of 
  11. "Alice's Restaurant", sort of).  I am going to start off by describing the 
  12. system as it "comes from the box" and then discuss the "programmability" of 
  13. Mi-Shell. 
  14.  
  15. Mi-Shell comes from OPENetwork for only $49.00, less than the cost of any of 
  16. the other comparable shell programs (such as Norton Commander, my previous 
  17. favorite).  The installation is simple and is done without all of the hidden, 
  18. inaccessible system bashing that is so common today.  Three simple DOS 
  19. commands install the package: make a directory for the package, change to that 
  20. directory, run the self-extracting pk-unzip on the distribution diskette.  The 
  21. package is installed and ready to run!  If you want to start the shell on you 
  22. own, type 'MSH' from the DOS prompt, or you can edit your AUTOEXEC.BAT to 
  23. start it every time you boor your system.  It is also advisable to add the MSH
  24. directory to your path, especially if you want to start MSH from some other 
  25. directory, and/or use the "magic" function.  "magic" is the name given by 
  26. OPENetwork (ON) to the function that permits all but an 8k "kernel" of MS to 
  27. be swapped out of RAM, freeing it for use by applications it "launches".   
  28.  
  29. MSH comes all set up to run in a default configuration that is a good starting 
  30. point for many needs.  Much of the default configuration reflects the Norton 
  31. Commander's (NC) contribution to the field of shells.  There are two 
  32. independent windows.  Each is controlled independently.  There are two file 
  33. display modes, like NC, 3 columns of file names or 1 column with size, date & 
  34. time information included. Unlike NC, however, the length of each window can 
  35. be adjusted from one line to 20. Movement within the windows is similar (but 
  36. not identical).  There is a "menu bar" on the top of the screen that can be 
  37. one or two lines, and the DOS prompt is always on the 25th line (like NC).  
  38.  
  39. All of the capabilities of NC are available (with some minor differences) for 
  40. "tagging" files, copying the currently highlighted file's name to the command 
  41. line, copying, deleting, moving, etc.  But there are many more functions 
  42. available with MSH in this mode.  In the NC, things typed that are not commands 
  43. to NC are placed on the line at the DOS prompt, and "ENTER" will pass that 
  44. string to COMMAND.COM normally. MSH has this capability as well as many of the 
  45. features of the best "command line editors" for recalling and editing past 
  46. commands.  This has always been one of my biggest complaints about NC. 
  47.  
  48. Things typed on the command line can also be used by MSH for purposes other 
  49. than command execution.  For instance, if I type '*.obj', it will appear on 
  50. the command line.  If I then hit 'ALT-P' the display for the current window 
  51. will contain only the files in that directory that match that string as if I 
  52. had typed "DIR *.OBJ".  Another key would have "tagged" all files with the 
  53. "obj" extension for use in "looped" commands (to be discussed later on).  In 
  54. the default configuration there are 70+ commands like these defined.  NC has 
  55. only a dozen or so.  
  56.  
  57. So far MSH looks like a nice shell program at a nice price, but so what?  Well, 
  58. now we come to my favorite part.  If you don't like a command, you can change 
  59. it, delete it or replace it.  You can also add new commands that you define, 
  60. and lastly, you can link in whole new functions that you write and compile 
  61. (examples for C programmers are included, but the information can be extended 
  62. to assembly language at least, and perhaps to other languages by OPENetwork in 
  63. the future?). 
  64.  
  65. Now lets begin to look at how MSH works, and how we, the users, can change it 
  66. for our needs.  The entire system, as it comes "out of the box", is built from 
  67. control files that use a simple, but powerful, set of "primitives" to create 
  68. the commands that you actually execute.  The system is built upon a "stack 
  69. oriented" processor that is at the core of Mi Shell.  It is very similar to the 
  70. "Forth" programming language, and in fact, several of the basic commands like 
  71. 'dup' (which duplicates the top item of "the stack") and 'swap' (which 
  72. exchanges the top two items on "the stack") are identical.  A more familiar 
  73. example would be the RPN calculators, like the H.P. series, that use a stack.  
  74. You enter numbers onto the stack, and "operation keys" like '*' (multiply) 
  75. operate on one or more items on the stack.  Lets take the multiply example.  
  76. First you have to get the two numbers to be multiplied onto the stack.  To do 
  77. that you type the number (say '123.5').  That is the top of the stack.  Now 
  78. touch the "enter" key, which is similar to the 'dup' function, and that number 
  79. is duplicated in the to two items on the stack. Now enter the next number (say 
  80. '20') which will become the top stack item.  At this point the stack has two 
  81. items, your numbers '123.5' and '20'.  If you now press the '*' key, those 
  82. two numbers are removed from the stack, multiplied and the result ('2470') is 
  83. pushed onto the stack.  Now instead of the two original numbers, the stack has 
  84. only the single result.  If all of this sounds very complicated, don't panic!  
  85. It is harder to describe than it is to use.  
  86.  
  87. Another reason to relax is that most of the more common changes are very 
  88. straight forward (mostly because OPENetwork did a great job of designing their 
  89. default configuration files).  Lets look at the first few changes that you will 
  90. want to make (these are fully described in the manual).  We will modify a file 
  91. called CONFIG.MSH.  This is the master configuration file. 
  92.  
  93. First, lets change the editor to be called by MSH when you have selected a 
  94. file and press the F4 key to edit it.  Mi-Shell is initially configured to use 
  95. an editor that is included with the package.  This is a small, fast editor that 
  96. is very usable for small editing jobs (similar to the editor that NC supplies 
  97. with their package. There is a line in CONFIG.MSH: 
  98.  
  99.          "mwe "editor!          | define your editor
  100.  
  101. The text between the quotes is the name of the editor that MSH supplies, mwe.  
  102. Everything after the '|' is a comment.  There are lots of comments in the 
  103. files that OPENetwork included to help make your job easier. 
  104.  
  105. Lets take a moment to look at this line and what it is doing.  The line is 
  106. scanned from left to right (just like you read, I hope).  The first thing that 
  107. MSH finds is a string (everything between the quotes).  That is called a token.  
  108. Tokens are always pushed onto the stack.  So now we have one thing on the 
  109. stack, a string token ("mwe ").  Now MSH comes to 'editor'.  It is not in 
  110. quotes, so it is not a string, it is an object.  Ending the line is the 
  111. exclamation mark, '!'.  That is one of the built in 'primitive' commands.  It 
  112. takes the second token on the stack (the string "mwe ") and stores it in the 
  113. object named by the top of the stack (editor).  Now 'editor' contains the 
  114. string "mwe ", and the stack is empty. 
  115.  
  116. So, to make MSH use the PC-Write Lite editor (from Quicksoft), for example, 
  117. change that line to read: 
  118.  
  119.          "lite "editor!         | define your editor
  120.  
  121. It is as simple as that.  Now 'editor' contains "lite ", and when you press 
  122. 'F4' to edit files, MSH will use PC-LITE as the editor.  Next in line are the 
  123. controls for the disk drives that are available for MSH to use.  The following 
  124. lines in the file show that section of the file as shipped: 
  125.  
  126.         |"CD" fixed_drives!    | define your fixed drives
  127.          "CD" fixed_drives!
  128.         |"AB"floppy_drives!    | define your floppy drives
  129.          "AB"floppy_drives!
  130.  
  131. You can adjust it for extra drives that you want to be able to use, or you can 
  132. lock MSH out of particular drives as you desire.  For example, My 'D' drive is 
  133. being used by a non-DOS operating system at the moment, so I changed the 
  134. fixed_drives line as follows:
  135.  
  136.          "C"fixed_drives!
  137.  
  138. and so MSH does not know about the D drive and does not get confused by 
  139. requests to search all drives for a file, for example.  Lastly, lets tell MSH 
  140. about some utility programs that I have available.  These are lines in the 
  141. same file: 
  142.  
  143.          false berk!
  144.          false delta!
  145.          false berk_cpmvrm!
  146.  
  147. Again we push two items onto the stack and store the second one in the top 
  148. one.  However, this time we do not have a string as the second item.  The 
  149. 'false' is a primitive that pushes a value that equates to false in tests 
  150. (zero for number items and empty string for string items).  Now when the store 
  151. command (the !) executes, it stores "false" in the indicated locations.  There 
  152. is also a 'true' primitive for the obvious alternate boolean tests. 
  153.  
  154. Again the MSH manual explains how and why to change these, but it should be 
  155. apparent.  I have the Berkeley Utilities and delta, so the first two changes 
  156. should be obvious.  The third line controls the set of functions that MSH uses 
  157. for copy, move and delete functions.  When it is set to true, MSH uses  
  158. versions based on the Berkeley Utilities functions 'cp' 'mv' and 'rm', 
  159. otherwise it uses the DOS 'COPY' and 'DELETE' commands.  I like BU, so I set 
  160. this one to true also and end up with: 
  161.  
  162.          true berk!
  163.          true delta!
  164.          true berk_cpmvrm!
  165.  
  166. That is all that is required for many of the changes you are likely to need to 
  167. make, especially in the beginning.  As you become used to MSH and its initial 
  168. configuration, you will think of things to adjust, change, add or delete.  
  169. Lets look at a couple of these more complicated changes.  
  170.  
  171. First, I hate to wait for computers (they are supposed to be instantaneous, 
  172. after all), and one of the things that PC-LITE does when starting up is to ask 
  173. if a backup file should be created or not.  There is a command line switch 
  174. that bypasses that prompt and automatically creates the backup and goes 
  175. directly to editing (another option does not create the backup before the 
  176. editing starts).  However, the switch has to come after the name of the file 
  177. to be edited, and so I cannot make a change to the editor definition we looked 
  178. at above.  The change has to be made in a different section of Mi-Shell's 
  179. configuration, a different file altogether, as a matter of fact.
  180.  
  181. Here is the most difficult part of changing the MSH system, finding the correct 
  182. file to change,  There are 17 '.msh' files supplied with the system.  Luckily, 
  183. 4 have almost all of the code for configuring the system.  In all fairness, 
  184. after a about thirty minutes "poking around" in these files I had a good idea 
  185. where to look for the appropriate code to change.  
  186.  
  187. The four main files are CONFIG.MSH, the master config file already mentioned;
  188. KEYBIND.MSH, which describes the functions assigned to keys; MENU.MSH is for 
  189. the menu and its functions; and STDDEFS.MSH, which defines most of the high 
  190. level functions used by the other three files.  There is also a file, 
  191. BERK.MSH, that defines functions using the Berkeley Utilities; DEMO.MSH and 
  192. DEMO2.MSH are tutorial/sample files that help to describe the MSH environment 
  193. and operation (they can be started from the MSH main menu); HELP.MSH which has 
  194. most of the help "stuff"; and EXT.MSH is where the 'extension' based 
  195. operations are defined (i.e. if the file extension is '.wks' start '123').  
  196. The other are 6 '.MSH' files are for various display/video card combinations, 
  197. only one of which will be used in any particular installation, and lastly 
  198. there is MANDEL.MSH, which shows off a fractal drawing program that is 
  199. distributed (along with a version of the game 'life' that is very nice) with 
  200. Mi-Shell. 
  201.  
  202. At any rate, I found the appropriate file (KEYBIND.MSH, which has most of the 
  203. key assignment data) and the appropriate line of code: 
  204.  
  205.         (editor current.name&exec)F4!
  206.  
  207. Lets dissect this line.  There are three "things" on the line.  Everything 
  208. between the parentheses is the first "thing".  Just as in most languages, 
  209. parentheses are used to group items.  The next "thing" on the line is 'F4' and 
  210. finally the '!'.  The first two "things" (or objects) are "pushed" onto the 
  211. stack.  The exclamation point is the same 'store' command we have already 
  212. seen.  It saves the 'editor current.name&exec' object (we will talk about what 
  213. that is in a bit) in the 'F4' object (i.e. what is "executed" every time the 
  214. F4 key is pressed). 
  215.  
  216. So far so good, but what did we store at F4?  We stored an object with four 
  217. parts: 'editor', 'current.name', '&' and 'exec'.  Starting on the left, we 
  218. have 'editor'.  That is the object that we changed earlier to use the name of 
  219. our editor.  When it is encountered, the string that we assigned to the object 
  220. 'editor' ("lite ") is placed on the stack.  Next is 'current.name'.  This is 
  221. one of the MSH defined 'primitives'.  It "pushes" the currently highlighted 
  222. file name on the current directory panel onto the stack.  We next come to the 
  223. '&'.  This is another MSH command called 'and', 'append' or 'concatenate'.  It 
  224. takes the top two items from the stack, "sticks them together" and then puts 
  225. the result back onto the stack.  For example, if we assume that current.name 
  226. pushed 'sample.txt', after the '&' the top item on the stack will be 'lite 
  227. sample.txt'.  Finally we come to 'exec', another MSH primitive. 'exec' sends 
  228. the top stack item to DOS to be executed ('lite sample.txt' in this example).
  229.  
  230. Now that we know what the OPENetwork version of the command does, we can 
  231. modify it for our needs.  What we want is to add " /e" to the string that is 
  232. sent to DOS.  All we have to do is include that string and append it to the 
  233. string already built using the '&' command just discussed.  Our modified 
  234. command definition looks like this: 
  235.  
  236.         (editor current.name " /e"&&exec)F4!
  237.  
  238. It could also look like this:
  239.  
  240.         (editor current.name& " /e"&exec)F4!
  241.  
  242. Both definitions will create the string 'lite sample.txt /e' for 'exec'.
  243.  
  244. Using the tutorials and these simple changes as examples, it is easy to create 
  245. your own definitions.  You can assign definitions to all four states of the 
  246. function keys, Normal, Shifted, Alt and Ctrl.  Also, all four versions of the 
  247. PgUp, PgDn, Home, End, arrows, Grey +, -, *.  Then there are the Ctrl and Alt 
  248. versions of all of the letter and number keys.  That is a total of 160 keys 
  249. that can have definitions.  Less than half of them have been defined in the 
  250. default configuration, which leaves a lot of room for your custom definitions!  
  251. There are also half a dozen mouse clicks that can be defined, including 
  252. support for three button rodents.
  253.  
  254. Besides the ample documentation and comments supplied with MSH, there is 
  255. another tool that they had the good sense to supply.  That is an interactive 
  256. debugger that you can turn on and off as desired.  When it is enabled, each 
  257. piece of a command can be stepped through one action at a time.  The contents 
  258. of the stack are displayed as well as the current object being process, 
  259. including a pointer to the next "thing" to be processed.  It is shown off well 
  260. in the tutorial, and I was able to make use of it in debugging a fairly 
  261. complicated command that I was trying to create.  A couple of minutes with the 
  262. debugger showed me the error the first time through (I had spent about half an 
  263. hour before that using trial and error to solve the problem without success).
  264.  
  265. In relation to the above debugging session, I should also mention another 
  266. great feature.  Once you have made some changes to one of the configuration 
  267. files, you can "re-load" the system to use the new commands without having to 
  268. "back-out" of Mi-Shell and then restart it.  This is a real time saver when 
  269. you are trying to create a new command.  The last point to bring up here is 
  270. that I have to say that the system is VERY robust.  I made some REAL stupid 
  271. syntax mistakes while I was trying my hand at writing commands, and I never 
  272. once was able to "lock-up" Mi-Shell (I have crashed Norton Commander more than 
  273. once, and it is not programmable). 
  274.  
  275. If all of the inherent programmability is not enough for you, there is also 
  276. the ability to link in your own function written in C using the sample files 
  277. that are supplied as a basis.  There is a complete set of example files that 
  278. create an example set of additional commands for MSH, including a batch file 
  279. that will compile, link, etc, the new system.  The sample batch file assumes 
  280. the Borland Turbo C compiler, but it took only a few minutes to convert for my 
  281. Microsoft C compiler.
  282.  
  283. I hope that this short introduction has given you a good idea of the power 
  284. inherent in this package.  If, like me, you have never been satisfied with the 
  285. current crop of DOS shell programs, Mi-Shell from OPENetwork may be the one 
  286. that you have been waiting for too.  
  287.